<template>
  <div>
    <div>
      <el-form :inline="true" :model="createForm" class="demo-form-inline" size="mini">
        <el-form-item label="昵称">
          <el-input v-model="createForm.room" placeholder="请输入昵称"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="create">创建用户</el-button>
        </el-form-item>
      </el-form>
      <el-divider/>
    </div>

    <el-tabs class="chatTab" tab-position="left">
      <template v-for="(item, index) in roomList">
        <el-tab-pane :label="item.name" :name="item.name" :key="index">
          <div class="modal">
            <div class="modal-header">
              <h3>聊天室</h3>
            </div>
            <div class="modal-body">
              <p>modal content</p>
            </div>
            <div class="modal-footer">
              <el-form :model="chatForm" class="chatPanel" :inline="true">
                <el-form-item>
                  <el-input style="width: 400px" type="textarea" :row="5" v-model="chatForm.msg" placeholder="请输入消息内容"></el-input>
                </el-form-item>
                <el-form-item>
                  <el-button size="mini" type="primary" @click="send">发送</el-button>
                </el-form-item>
              </el-form>
            </div>
          </div>
        </el-tab-pane>
      </template>
    </el-tabs>

  </div>
</template>

<script>
export default {
  name: "index",
  data() {
    return {
      createForm: {
        room: ''
      },
      roomList: [{name: "房间1", size: 5}, {name: "房间2", size: 5}, {name: "房间3", size: 5}, {name: "房间4", size: 5}],
      chatForm: {},
      msgFrom: {msg: ''}
    }
  },
  methods: {
    create() {
      console.log('submit!');
    },
    add() {

    },
    send() {

    }
  }
}
</script>

<style scoped>
.chatTab{
  height: 410px;
}
.modal {
  background-color: lightblue;
  box-shadow: 2px 2px 10px 1px;
  border-radius: 10px;
  width: 550px;
  height: 400px;
}
.modal-header {
  border-bottom: 1px solid #eee;
  padding: 1px;
  height: 50px;
}
.modal-body {
  position: relative;
  padding: 10px 10px;
  height: 250px;
}
.modal-footer {
  border-top: 1px solid #eee;
  padding: 10px;
}

</style>
